// 统一管理接口  所有的

// 序列化
import qs from "qs";
import request from "../request/request";

// 请求精品推荐数据  函数不会立即执行,只会在调用的时候执行  在组建中调用
// export const JingPinAPI = () => request.get("/products/recommend");  http://192.168.113.249:8081/cms
export const JingPinAPI = () => request.get("/products/recommend");
// 发送短信验证码登录
export const SendSMSAPI = (params) =>
  request.post("/sendSMS", qs.stringify(params));

//   发送手机号登录
export const PhoneReginAPI = (params) =>
  request.post("/phoneRegin", qs.stringify(params));

export const WeixinLoginAPI = (params) =>
  request.post("/wechatUsers/PCLogin", qs.stringify(params));

// 手机号绑定微信/wechatUsers/binding
export const BindingAPI = (params) =>
  request.post("/wechatUsers/binding", qs.stringify(params));

// console.log(
//   "qs.stringify:",
//   qs.stringify({ phone: 12356789101, name: "张三" })
// );

// /shop/userProfiles 获取用户信息
export const UserProfilesAPI = () => request.get("/shop/userProfiles");

// /products/hot  热门兑换
export const RemenAPI = () => request.get("/products/hot");

//商品详情页/products/{id}
export const GoodDetailsAPI = (id) => request.get(`/products/${id}`);

// 加入购物车 /shop/carts/add
export const CarsAddAPI = (params) =>
  request.post("/shop/carts/add", qs.stringify(params));

//   全部商品  /products
export const ProductsAPI = (params) => request.get("/products", { params });

// 查看购物车  /shop/carts
export const CarsAPI = () => request.get("/shop/carts");
